<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'emp-list.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <s:debug></s:debug><br>
  <body>
  	<s:form action="emp-create" theme="xhtml">
  		<s:iterator value="employeeColumnNames" var="temp" begin="1">
				<s:textfield name="%{temp}" label="%{temp}" value=""></s:textfield>  
		</s:iterator>			
  		<s:submit></s:submit>
  	</s:form>
  	
    <table cellpadding="10" cellspacing="0" border="1">
    	<thead>
    		<tr>
				<s:iterator value="employeeColumnNames">
					<td><s:property value="[0].toString()"/></td>
				</s:iterator>
				<td>Edit</td>
				<td>Delete</td>
    		</tr>
    	</thead>
    	
    	<tbody>
			<s:iterator value="#request.employees">
				<tr>
					<s:iterator value="employeeColumnNames" var="temp">
						<td>
							<c:set var="columnName" value="${temp}" scope="request"></c:set>
							${requestScope[columnName]}
						</td>
					</s:iterator>
					<td><a href="emp-edit?id=${id}">Edit</a></td>
					<td><a href="emp-delete?id=${id}">Delete</a></td>
				</tr>
			</s:iterator>
    	</tbody>
    </table>
  </body>
</html>
